<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>PhotoSphereViewer - visible range demo</title>

  <link rel="stylesheet" href="../dist/photo-sphere-viewer.css">
  <link rel="stylesheet" href="style.css">
</head>
<body>

<div id="photosphere"></div>

<script src="../node_modules/three/build/three.js"></script>
<script src="../node_modules/uevent/browser.js"></script>
<script src="../dist/photo-sphere-viewer.js"></script>
<script src="../dist/plugins/visible-range.js"></script>

<script>
  const viewer = new PhotoSphereViewer.Viewer({
    container     : 'photosphere',
    panorama      : 'https://photo-sphere-viewer-data.netlify.app/assets/sphere-cropped.jpg', // this file has XMP data
    caption       : 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
    loadingImg    : 'assets/photosphere-logo.gif',
    defaultZoomLvl: 30,
    navbar        : [
      'autorotate',
      {
        content  : 'Clear range',
        className: 'custom-button',
        onClick  : () => {
          visibleRange.setLongitudeRange(null);
          visibleRange.setLatitudeRange(null);
        },
      },
      {
        content  : 'Set custom range',
        className: 'custom-button',
        onClick  : () => {
          visibleRange.setLongitudeRange([-Math.PI / 2, Math.PI / 2]);
          visibleRange.setLatitudeRange([-Math.PI / 3, Math.PI / 3]);
        },
      },
      {
        content  : 'Set range from panoData',
        className: 'custom-button',
        onClick  : () => {
          visibleRange.setRangesFromPanoData();
        },
      },
      'caption',
      'fullscreen',
    ],
    plugins       : [
      [PhotoSphereViewer.VisibleRangePlugin, {
        usePanoData: true,
      }],
    ],
  });

  const visibleRange = viewer.getPlugin(PhotoSphereViewer.VisibleRangePlugin);

</script>
</body>
</html>
